using Aurora.TaskScheduler.Abstractions.BaseModel;
using Aurora.TaskScheduler.DistributedLock.NewLifeRedis;

namespace Aurora.TaskScheduler.DistributedLock;

public static class RedisTaskDistributeLockExtension
{
    /// <summary>
    /// 使用 redis distribute lock
    /// </summary>
    /// <param name="options"></param>
    /// <param name="configure"></param>
    /// <returns></returns>
    public static TaskSchedulerOptions UseRedisTaskDistribute(this TaskSchedulerOptions options,
        Action<RedisTaskDistributeLockOptions> configure)
    {
        if (configure == null) throw new ArgumentNullException(nameof(configure));
        options.RegisterExtension(new RedisTaskDistributeLockOptionExtension(configure));
        return options;
    }
}